﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using sharp_net.Repositories;
using zkdao.Domain;
using zkdao.Enum;

namespace zkdao.Repositories.EF {

    public class EFDbContextInitializer : CreateDatabaseIfNotExists<EFDbContext> {

        protected override void Seed(EFDbContext context) {
            base.Seed(context);

            var tags = new List<Tag> {
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "数码电子" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "家用电器" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "汽车" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "化妆品" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "健康" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "食品" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "文化" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "票务" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCategory, Name = "奇葩" },

                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "学弟" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "学妹" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "屌丝" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "居家" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "潮男" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "潮女" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "品味男" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "气质女" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "高帅富" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.GoodsCustomer, Name = "白富美" },

                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.InfoCategory, Name = "折扣" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.InfoCategory, Name = "资讯" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.InfoCategory, Name = "攻略" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.InfoCategory, Name = "海淘攻略" },

                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountPrice, Name = "给力" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountPrice, Name = "限时" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountPrice, Name = "八哥" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountPrice, Name = "免费" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountPrice, Name = "蚊子肉" },

                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountSource, Name = "团购" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountSource, Name = "B2C" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountSource, Name = "天猫" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.DiscountSource, Name = "代购" },

                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "不限地区" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "上海" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "常州" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "北京" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "广州" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "武汉" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "深圳" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "杭州" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "成都" },
                new Tag { CreatTime = DateTime.Now, ActEnum = (int)eAct.Normal, Id = Guid.NewGuid(), GroupEnum = (int)eTagGroup.AreaLimit, Name = "天津" },
            };
            tags.ForEach(s => context.Tags.Add(s));

            var adminer = new User();
            adminer.Creat();
            adminer.Email = "zicjin@gmail.com";
            adminer.PasswordHash = User.GetHashPassword("j5656j");
            context.Users.Add(adminer);

            context.SaveChanges();

        }

    }
}